Fix[Referenda]: Use BoundedVec<u8> as field type for TrackInfo::name#7667
Fix[Referenda]: Use BoundedVec<u8> as field type for TrackInfo::name#7667pandres95 wants to merge 3 commits intoparitytech:stable2503from
BoundedVec<u8> as field type for TrackInfo::name#7667Conversation
| pub struct TrackInfo<Balance, Moment, const N: usize = DEFAULT_MAX_TRACK_NAME_LEN> { | ||
| /// Name of this track. | ||
| #[codec(encoded_as = "ArrayLikeVec<N>")] | ||
| pub name: [u8; N], |
There was a problem hiding this comment.
Why was this changed to an array and not a static Str as before?
There was a problem hiding this comment.
it is to be able to decode it from storage, the intention is to be able to have tracks defined in storage.
There was a problem hiding this comment.
Yes. That's the reason.
@gui1117 I tried changing the approach to use BoundedVec as it encodes better, but then there's the problem of needing to allocate memory while statically initializing the tracks data variables in the runtimes.
That approach requires reviving the usage of lazy_static (which I guess we don't like it very much @bkchr).
|
it should be checked that this works with pjs, and if not we should wait for pjs to be fixed. |
|
Also this doesn't fix the fact that |
|
I initially noticed the above committed solution ( So, I tried changing the structure to use
The problem is mostly solved by using I can propose a fix in polkadot-js/apps#11310 for the components, but using
|
Vec<u8> as associated encoding type for TrackInfoBoundedVec<u8> as field type for TrackInfo::name
1e353be to
ddfc42c
Compare
ddfc42c to
5f58579
Compare



This PR fixes an issue that appeared after merging #2072 to
stable2503, where encoding breaking changes cause issues on PJS.